//刚刚，几分钟，几小时前
var time
function timefn(oldTime)
{
    var newTime= new Date().getTime()
    var time=newTime-oldTime.getTime()
    console.log(oldTime);
    if((time/1000)<60)
    {
        document.write("刚刚")
    }
    else if(parseInt(time/1000/60)<60)
    {
        document.write(parseInt(time/1000/60)+"分钟前")
    }
    else if(parseInt(time/1000/60/60)<24)
    {
        document.write(parseInt(time/1000/60/60)+"小时前")
    }
    else if(parseInt(time/1000/60/60/24)<31)
    {
        document.write(parseInt(time/1000/60/60/24)+"天前")
    }
    else if(parseInt(time/1000/60/60/24/30)<12)
    {
        document.write(parseInt(time/1000/60/60/24/30)+"个月前")
    }
    else 
    {
        document.write(parseInt(time/1000/60/60/24/30/12)+"年前")
    }  
}
// timefn(time=new Date(2021,7,26,11,44,35))







//判别是那种浏览器
function fn()
{
    if(navigator.userAgent.indexOf("Trident") > -1) document.write("这是IE浏览器")
    if(navigator.userAgent.indexOf("Opera") > -1) document.write("这是欧朋浏览器")
    if(navigator.userAgent.indexOf("Chrome") > -1) document.write("这是谷歌浏览器")
    if(navigator.userAgent.indexOf("Firefox") > -1) document.write("这是火狐浏览器")
}

fn()







//判别是移动端还是PC端
if(!!navigator.userAgent.match(/AppleWebKit.*Mobile.*/) || !!navigator.userAgent.match(/AppleWebKit/)) 
{
    document.write("这是PC端")
}
else
{
    document.write("这是移动端")
}







//判断是否是微信内部浏览器
if(navigator.userAgent.indexOf('MicroMessenger') > -1) document.write("这是微信内部浏览器")